package com.xy.controller;

import com.xy.api.model.response.R;

public class BaseController {

    private static final int SUCCESS_CODE = 200;

    private static final String SUCCESS_MSG = "操作成功";

    private static final int FAIL_CODE = 200;

    private static final String FAIL_MSG = "操作失败";

    public R success() {
        return new R(SUCCESS_CODE, SUCCESS_MSG, null);
    }

    public R success(Object data) {
        return new R(SUCCESS_CODE, SUCCESS_MSG, data);
    }

    public R fail() {
        return new R(FAIL_CODE, FAIL_MSG, null);
    }

    public R fail(String message) {
        return new R(FAIL_CODE, message, null);
    }

    public R fail(int code, String message) {
        return new R(code, message, null);
    }
}
